home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / video / fly8111-.000 / fly8111- / fly8 / docs / internal.txt < prev    next >
Text File  |  1979-12-31  |  14KB  |  527 lines

  1. internal.txt
  2.  
  3. This is part of the flight simulator 'fly8'.
  4. Author: Eyal Lebedinsky (eyal@ise.canberra.edu.au).
  5.  
  6.  
  7. Modules
  8. =======
  9.  
  10.  
  11. portable
  12. --------
  13.  
  14. ALTITUDE.C    display HUD altitude
  15. AUTOP.C        Auto pilot simulator
  16. BODY.C        bodies mgmt
  17. COCKPIT.C    draw instruments
  18. COLORS.C    color mgmt
  19. COMMAND.C    process user commands
  20. DEBUG.C        debug support functions
  21. DEVICE.C    graphics devices mgmt
  22. FLY8.C        main program
  23. GETSTR.C    accept user input with editing and history
  24. HEADING.C    display HUD heading
  25. HUD.C        head-up-display painter: graphics
  26. HUDMENU.C    hud setup menus
  27. IFUNCS.C    integer trig functions
  28. ILS.C        display and manage the ILS system
  29. INFO.C        screen text display
  30. INIT.C        program initialization
  31. ITABS.C         integer trig tables (generated by ifuncs.c)
  32. KEYBOARD.C      keyboard devices mgmt
  33. KEYPAD.C
  34. LAND.C          algorithmic landscape
  35. LOG.C        print to log
  36. LOOP.C        the main busy-loop of the simulation and display
  37. MACROS.C        handle keyboard macros
  38. MAT.C        3D matrix handling
  39. MEMORY.C    memory mgmt
  40. MENU.C        menu interaction support
  41. MENUS.C        menus used by the system
  42. MESSAGE.C    handle display messages queue.
  43. NETPORT.C    network access mgr (mid level)
  44. OBASIC.C    object: plane - cross between Classic and F16.
  45. OBJECT.C    'object' data structure mgmt
  46. OBJECTS.C    3D objects mgmt
  47. OBOX.C        object: box
  48. OBROKEN.C    object: fragment
  49. OCHUTE.C    object: ejecting pilot
  50. OCLASSIC.C    object: plane - a wild spaceship.
  51. OCRATER.C    object: bomb crater
  52. OGROUND.C    object: ground (land)
  53. OGTARGET.C    object: ground target
  54. OHOUSE.C    object: house (land)
  55. OLOW.C        object: low level ground (crash alert)
  56. OM61.C        object: M61 bullet.
  57. OMK82.C        object: MK82 bomb
  58. OPADDOC.C    object: paddoc (land)
  59. OPLANE.C    object: plane
  60. ORUNWAY.C    object: runway (land)
  61. OSMOKE.C    object: smoke particle
  62. OTARGET.C    object: target
  63. OTOWER.C    object: control tower
  64. OVIEWER.C    object: viewer
  65. OXPLANE.C    object: experimental plane
  66. PID.C        automatic control logic
  67. PIPER.C        display HUD radar piper
  68. PITCH.C        display HUD pitch ladder
  69. PLAYER.C    remote players maintenance
  70. POINTER.C    pointing devices mgmt
  71. RADAR.C        display HUD radar info
  72. RANDOM.C    random pointing device emulator
  73. REMOTE.C    remote comms interface (high level)
  74. SHOW.C        3D graphics wire-frame routines
  75. SKY.C        algorithmic sky painting
  76. SOUND.C        sound devices mgmt
  77. SPEED.C        display HUD speed
  78. STFONT1.C    stroke font (square, fast, cold)
  79. STFONT2.C    stroke font (round, slow, nice)
  80. STROKE.C    stroke character generator used in HUD
  81. SYSTEM.C    system-wide functions
  82. TERM.C        program termination
  83. TUNES.C        tunes used for sound
  84. UTIL.C        misc functions
  85. VIEWS.C        render ann views (cockpit, HUD and all HDD)
  86. VMODES.C    read in the fly.vmd file
  87. WINDOW.C    windows and screen sizing functions
  88.  
  89.  
  90. Headers
  91. -------
  92.  
  93. COLORS.H    color definitions
  94. FLY.H        the main header
  95. HUD.H        header for HUD modules
  96. NOTES.H        used to define sounds (notes and tunes)
  97. KEYOFD.H    --"--
  98. KEYOFC.H    --"--
  99. KEYDEF.H    key definitions (internal to fly8)
  100. KEYMAP.H    key mapping to fly8 functions
  101.         in the future this may be replaced with externaly defined
  102.         key mapping.
  103. PLANE.H        plane related stuff
  104.  
  105.  
  106. MSDOS
  107. -----
  108.  
  109. CONFIG.H    non portable definitions
  110.  
  111. DRIVERS.C    lists all drivers, but otherwise portable.
  112. KEYPAD.C    the keyboard as a pointing device (portable code except you
  113.         may re-assign keys).
  114. CONSOLE.C    low level PC keyboard access
  115. GRQC.C        graphics device driver (using QuickC graphics)
  116. GRT4K.C        graphics device driver (using low-level tseng4k access)
  117. MOUSE.C        the mouse as a pointing device
  118. PACKET.C    low level packet net driver (ethernet packet level)
  119. PCDOS.C        miscelanious system functions (pcdos)
  120. PCSERIAL.C    low level serial net driver
  121. SLIP.C        low level packet net driver (SLIP protocol)
  122. SPEAKER.C    PC speaker sound ouput driver
  123. STICK.C        the joystick as a pointing device
  124. TIMER.C        timer functions
  125. GETTIMER.C    stanalone pgm to read the timer chip channel 0
  126. SETTIMER.C    stanalone pgm to set the timer chip channel 0 to mode 3
  127.  
  128. MSUBS.ASM    fast fixed point math, replaces some C functions.
  129.  
  130. MAKQC.TOP    makefile for portable files (QuickC)
  131. MAKQC        makefile for msdos files (QuickC)
  132. MAKC7.TOP    makefile for portable files (C7)
  133. MAKC7        makefile for msdos files (C7)
  134.  
  135. FLY.INI        configuration file
  136. FLY.BAT        short batch file for running fly8
  137. GRQC.VMD    graphics modes for grqc.c
  138. GRT4K.VMD    graphics modes for grt4k.c
  139.  
  140.  
  141. UNIX/X11
  142. --------
  143.  
  144. CONFIG.H    as above
  145.  
  146. CONSOLE.C    as above
  147. DRIVERS.C    as above
  148. MISC.C        as above
  149. MOUSE.C        as above
  150. UNIX.C        system services for UNIX
  151. NOSOUND.C    dummy sound driver.
  152. TIMER.C        as above
  153. GRX.C        graphics driver using X11
  154.  
  155. MAKEFILE.TOP    as above
  156. MAKEFILE    as above
  157.  
  158. FLY.INI        as above
  159. FLY        short script for running fly8
  160. GRX.VMD        graphics modes
  161.  
  162.  
  163. External support
  164. ----------------
  165.  
  166. Interrupt driven, buffered serial line support library (com.lib).
  167.  
  168. Standard graphics (microsoft C library).
  169. Fast 256 color VGA graphics (gr.lib).
  170.  
  171. Packet driver C interface (pktdrvr.lib).
  172.  
  173. Input line editing routine (util.lib).
  174. High resolution timer support (util.lib).
  175.  
  176.  
  177. Other files
  178. -----------
  179.  
  180. FLY.INI        parameters file (read)
  181. FLY.LOG        log file (write)
  182. FLY.MAC        keyboard macros save file (read/write)
  183.  
  184.  
  185. Porting
  186. =======
  187.  
  188. A minimal set of drivers will include:
  189.  
  190. DRIVERS.C    adjusted lists
  191.  
  192. CONSOLE.C    low level non-blocking keyboard access
  193. GRxxx.C        graphics device driver
  194. KEYPAD.C    the keyboard as a pointing device
  195. OpSys.C        miscelanious system functions
  196. NoSound.C    dummy sound driver
  197. TIMER.C        timer functions
  198.  
  199.  
  200. Program structure
  201. =================
  202.  
  203. main() is in fly8.c. After setting everything up (mainly initialize()) it
  204. calls user_command() [in command.c] which talks to the user. Whenever
  205. the program is in a busy wait it calls Sys->Poll() which calls idle_loop().
  206. This last one [in fly8.c] decides if it is time to show another frame and
  207. does so. It also drives the simulation program.
  208.  
  209. The program should have NO HARD WAITS!!!! The keyboard driver MUST do the poll
  210. when waiting for a keystroke.
  211.  
  212. Sys->Poll(int mode) has two modes:
  213.     0 poll all low level devices but do not call idle_loop()
  214.     1 do everything.
  215. This is to allow the main body of the simulation/rendering to call Sys->Poll()
  216. to enable sound etc. that needs constant polling.
  217.  
  218.  
  219.  An important issue is the separation of function between the different
  220. program layers. All objects have a 'native' world which is termed here a
  221. 'player'. There is the one 'native' player and many remote players. A
  222. player is identified by the pair (int netport, char address[]) which are
  223. treated as a black box. The remote player handler (remote.c) exchanges
  224. messages with remote users through a netport which is managed separately
  225. (netport.c). The messages are moved as packets. The same packets are
  226. then handed over to the network drivers (each enviroment had different
  227. ones) which does NOT have any understanding of the contents. A netport
  228. is directly related to a network access point (usually some hardware
  229. device) and the program can handle nore than one of these concurrently.
  230. While the low level programs (netport.c and net drivers) know nothing
  231. about fly8, remote.c knows a lot about it and knows how to talk to the
  232. netports but cannot control the net directly.
  233.  
  234.  During the design of the program (i.e when looking back at the blind
  235. at-the-keyboard programming sessions) various functions had to be placed
  236. at the prefered level - not always clear were that is. For example, the
  237. program can collect multiple logical packets and hande then to the
  238. network as one large real packet. The mechanizm for that ended up at the
  239. netport level. It could as easily have been left to each driver to do it
  240. when appropriate, or it could have been pushed up to the remote handler
  241. (who originally build all packets) to take care of that.
  242.  
  243.  One day the large header (fly8.h) will be split to reflect this
  244. layering and enforce more structure on the whole system. One day.
  245.  
  246.  
  247. e_plane.misc[20] allocation
  248. ---------------------------
  249.  
  250.   0    LIFETIME(p)    autopilot: millisecs to next randomization
  251.   1    SPEED(p)    autopilot: desired speed
  252.   2    HEADING(p)    autopilot: desired heading
  253.   3    ALTITUDE(p)    autopilot: desired altitude
  254.   4    NEWTGT(p)    time left for new target notice
  255.   5            Cm
  256.   6            high res R[Z] when on-ground
  257.   7            ...
  258.   8            pull up time
  259.   9            millisec life of water-line marker
  260.  10            autop: command speed.
  261.  11            bombs in flight counter.
  262.  12            autop: command pitch
  263.  13            autop: command roll
  264.  14            ILS glide path deviation
  265.  15            ILS localizer deviation
  266.  16            pullup cue relative angle
  267.  17            pullup cue time
  268.  
  269. e_plane.opt[10] usage
  270. ---------------------
  271.  
  272.   0 [0-2]    flight model: 0=basic, 1=classic, 2=xplane, 3=yplane.
  273.   1 [1-9]    controls response (damping factor)
  274.   2 [01]    use linear controls (all)
  275.   3 [1-9]    turning speed (classic only)
  276.  
  277.  
  278. e_imported.misc[5] allocation
  279. ------------------------------
  280.  
  281.  
  282. object.misc[5] allocation
  283. --------------------------
  284.  
  285.  0    bullet count for non ET_PLANE objects (imported planes).
  286.  0    viewer type for O_VIEWER (local).
  287.  
  288.  
  289. st.misc[20] allocation
  290. ----------------------
  291.  
  292.   0    last elapsed time
  293.   1    last video_time
  294.   2    last stats[27]
  295.   3    last stats[28]
  296.   4    last stats[29]
  297.   5    last stats[40]
  298.   6    plane dynamics minimum interval
  299.   7    sega glasses port [0 means none]
  300.   8    buttons mode.
  301.   9    flush log rate
  302.  
  303.  
  304. st.stats[100] allocation
  305. ------------------------
  306.  
  307. alloc    used    for
  308. -----    ----    ---
  309.  0- 9        comms
  310.      0    bytes sent
  311.      1    packets sent (physical)
  312.      2    bytes rcvd
  313.      3    packets rcvd (physical)
  314.      4    rcvd bad packet: crc & player OK but not collected by any
  315.         object (player.c) [but player playing].
  316.      5    rcvd bad packet: driver internal
  317.      6    rcvd bad packet: bad crc
  318.      7    rcvd bad packet: player unknown (if short of mem?)
  319.      8    send packet failed: sync (driver level)
  320.      9    send packet failed: async (driver level)
  321. 10-19        graphics
  322.     10    out->out (clipper)
  323.     11    in->in (clipper)
  324.     12    in->out/out->in (clipper)
  325.     13    hard: out (clipper)
  326.     14    hard: fail (clipper)
  327.     15    hard: in (clipper)
  328.     16    lines processed (per frame)
  329.     17    -
  330.     18    coms: low level soft send failure.
  331.     19    millis to next autoconnect
  332. 20-29        misc
  333.     20    com test count, input [pcserial.c]
  334.     21    com test max
  335.     22    com test total
  336.     23-25    same, for output
  337.     26    elements in display list
  338.     27    time for objects display calcs (NOT video)
  339.     28    time for objects simulation
  340.     29    sync time
  341. 30-39        video totals
  342.     30    bg/fb time (hud, test, sky etc.)
  343.     31    number of frames
  344.     32    total frames time
  345.     33    total video time
  346.     34    total [27] time
  347.     35    total [28] time
  348.     36    total [29] time
  349.     37    total [30] time
  350.     38    -
  351.     39    -
  352.  
  353. 30-39        memory, misc
  354.     40    debug.c error count
  355.     41    log last write time
  356.     42    -
  357.     43    -
  358.     44    -
  359.     45    memory bytes max used
  360.     46    memory bytes alloced
  361.     47    memory bytes now used
  362.     48    memory shortage (failed)
  363.     49    memory shortage (total)
  364.  
  365. 50-59        coms
  366.     50    recovered lost objects
  367.     51    objects timed out
  368.     52    bad packages received
  369.     53    rcvd packages
  370.     54    sent packages
  371.     55    rcvd noise packets from non-players
  372.     56    rcvd out of order packet
  373.     57    -
  374.     58    -
  375.     59    -
  376.  
  377. 60-69        graphics debug
  378.     60    x < 0    (Move)
  379.     61    x > width    (Move)
  380.     62    y < 0    (Move)
  381.     63    y > height    (Move)
  382.     64    x < 0    (Draw)
  383.     65    x > width    (Draw)
  384.     66    y < 0    (Draw)
  385.     67    y > height    (Draw)
  386.     68    line draw bad op
  387.     69    -
  388.  
  389. 70-79        misc
  390.     70-76    running total of 10-16
  391.     77
  392.     78    total MoveTo executed.
  393.     79    total DrawTo executed.
  394.  
  395. 80-89        temp counters
  396.  
  397. 90-99        temp counters
  398.  
  399.  
  400. st.flags GP* usage
  401. ------------------
  402.  
  403. DF_GPW        activate model Y instead of F.
  404. DF_GPX        show HUD graph
  405. DF_GPY        model F: fundamental=no-pitch, or linearized=do-pitch.
  406. DF_GPZ        model F: set FUNDAMENTAL mode
  407.  
  408.  
  409.  
  410. pointer.a[4] usage
  411. ------------------
  412.  
  413. Analog functions are:
  414.      0 right/left turn
  415.      1 up/down turn
  416.  
  417.  
  418. pointer.b[30] usage
  419. -------------------
  420.  
  421. logical functions are:
  422.      0   power up
  423.      1   power down
  424.      2   level (fly straight north)
  425.      3   return to origin (x,y,z=0)
  426.      4   stop (speed=0)
  427.      5   fire
  428.      6   rudder left/right
  429.      7   rudder center
  430.      8   stable (stop turning)
  431.      9   ...
  432.     10/a flaps
  433.     11/b spoilers
  434.     12/c reset roll
  435.     13/d air brakes
  436.     14/e wheel brakes
  437.     15/f gear
  438.     16/g power 100
  439.     17/h after burner up
  440.     18/i release lock
  441.     19/j wheel brakes (fine control)
  442.     20/k air brakes (fine control)
  443.     21/l trim right/left
  444.     22/m trim down/up
  445.     23/n trim reset
  446.  
  447.  
  448. pointer.opt[10] usage
  449. ---------------------
  450.  
  451.   1  [pn]    set x coord direction
  452.   2  [0-3]    set x coord function
  453.   3  [pn]    set y coord direction
  454.   4  [0-3]    set y coord function
  455.   5  [0-9]    set left button function
  456.   6  [0-3]    set right button function
  457.   7  [0-9]    set x coord sensitivity (mouse only)
  458.   8  [0-9]    set y coord sensitivity (mouse only)
  459.   9  [01]    read twice (joystick only)
  460.  
  461.  
  462. Asyncronous events
  463. ------------------
  464.  
  465. The only current such events are network traffic arrival. The two packet
  466. drivers slip.c and packet.c work in this way. pcserial.c expects characters
  467. to be delivered-to/retrieved-from routines in the serial library.
  468.  
  469. NEW() DEL() [memory.c] and deliver_packet() [netport.c] may be called 
  470. from interrupt routines and are protected by Disable/Enable. The
  471. structures manipulated in this way are:
  472.  
  473.     memory allocation.
  474.     netport incoming packets queue.
  475.  
  476. -------------------------------------------------------------------------------
  477. example of a dummy netport driver:
  478. ==================================
  479.  
  480. static int far
  481. com_init (NETPORT *np, char *options)
  482. /* Initialize netport 'np' with user options 'options'. 'options' is the
  483.  * unparsed string that the used supplied and is a list of options separated
  484.  * by colons. Use the get_?arg() functions to retrieve the options.
  485. */
  486. {
  487.     return (1);    /* always fail */
  488. }
  489.  
  490. static void far
  491. com_term (NETPORT *np)
  492. /* Terminate netport 'np'.
  493. */
  494. {
  495.     return;
  496. }
  497.  
  498. static int far
  499. com_send (NETPORT *np, PACKET *pack)
  500. /* Send packet 'pack' to netport 'np'.
  501.  * If 'pack' is zero then this is an indication that this is the last packet
  502.  * so drivers that send multiple packets in one message will send what they
  503.  * have.
  504. */
  505. {
  506.     return (1);    /* always fail */
  507. }
  508.  
  509. static int far
  510. com_receive (NETPORT *np)
  511. /* Receive all packets from netport 'np'. Used only by drivers that do polled
  512.  * receiving.
  513. */
  514. {
  515.     return (1);    /* always fail */
  516. }
  517.  
  518. extern struct NetDriver NetDummy = {
  519.     "Dummy",
  520.     0,
  521.     com_init,
  522.     com_term,
  523.     com_send,
  524.     com_receive
  525. };
  526. -------------------------------------------------------------------------------
  527.